export const schema = {
    type: "page",
    title: "提现账号审核",
    body: [
        {
            // type: "wrapper",
            // className: "b-l b-b b-r bg-white no-padder",
            //
            // body: {
                type: "crud",
                api: "/api/teamcashinfo?verify_status=${status}&page=${page}&keyword=${keyword}",
                panelClassName: "no-border no-shadow bg-white",
                toolbarInline: true,
                // toolbar: [
                //
                //     {
                //         label: "导出 ",
                //         type: "button",
                //         size: "sm",
                //         actionType: "url",
                //         className: "btn btn-info",
                //         url: "/api/teamcashinfo?asExcel=1"
                //     },
                // ],
                columnsTogglable: true,
                filter: {
                    title: "",
                    submitText: "",
                    panelClassName: 'no-border no-shadow b-b m-b-none b-light',
                    controls: [
                        {
                            type: "button-group",
                            btnActiveClassName: "btn-info active",
                            value: "",
                            submitOnChange: true,
                            name: "status",
                            options: [
                                {
                                    label: "全部",
                                    value: ""
                                },
                                {
                                    label: "待审核",
                                    value: "0"
                                },
                                {
                                    label: "已通过审核",
                                    value: "1"
                                },
                                {
                                    label: "未通过审核",
                                    value: "2"
                                }
                            ]
                        },
                        {
                            type: "text",
                            name: "keyword",
                            placeholder: "用户名/团队名称/手机号/银行卡号",
                            style: {minWidth: 260},
                            addOn: {
                                type: "submit",
                                label: "搜索",
                                primary: true
                            }
                        },
                        {
                            label: "导出",
                            type: "button",
                            // size: "sm",
                            level: "info",
                            actionType: "url",
                            // className: "btn btn-info",
                            url: "/api/teamcashinfo?asExcel=1"
                        },
                    ]
                },
                columns: [
                    {
                        label: "用户名",
                        name: "team.user.username"
                    },
                    {
                        label: "团队名称",
                        name: "team.name"
                    },
                    {
                        name: "org_id",
                        label: "所属机构",
                        type: "tpl",
                        tpl: `<% if (data.acl.can("org:view") && data.org) { %>
                    <a data-link='/org/view/<%= data.org.id %>'><%= data.org.name %></a>
                    <% } else { %>
                        <span><%= data.org ? data.org.name : '-' %></span>
                        <% } %>`
                    },
                    {
                        label: "姓名",
                        name: 'contacts_realname'
                    },
                    {
                        label: "手机号",
                        name: 'contacts_phone'
                    },

                    {
                        label: "状态",
                        name: "verify_status",
                        type: "map",
                        map: {
                            "0": "<span class='label label-warning'>待审核</span>",
                            "1": "<span class='label label-success'>已通过审核</span>",
                            "2": "<span class='label label-default'>未通过审核</span> ${verify_msg}",
                            "*": "${verify_status}"
                        }
                    },
                    {
                        label: "操作",
                        type: "operation",
                        width: 180,
                        buttons: [
                            {
                                type: "button",
                                size: "xs",
                                level: "info",
                                label: "查看",
                                actionType: "link",
                                link: "/finance/view/${id}"
                            },
                            {
                                visibleOn: "data.verify_status != 1",
                                type: "button",
                                size: "xs",
                                level: "primary",
                                label: "通过审核",
                                actionType: "ajax",
                                api: "put:/api/teamcashinfo/${id}?status=1"
                            },
                            {
                                visibleOn: "data.verify_status != 2",
                                type: "button",
                                size: "xs",
                                label: "驳回审核",
                                level: "danger",
                                confirmText: "确定要驳回审核？",
                                actionType: "dialog",
                                dialog: {
                                    title: "请输入驳回审核原因",
                                    body: {
                                        type: "form",
                                        api: "put:/api/teamcashinfo/${id}?status=2",
                                        controls: [
                                            {
                                                label: false,
                                                type: "text",
                                                name: "reason"
                                            }
                                        ]
                                    }
                                }
                            },
                        ],
                    }
                ]
            // }
        }
    ]
};
